<template>
  <div class="scroll-smooth bg-white">
    <nuxt />
    <!-- <GlobalLoader :loadings="showLoading" ref="loadings" /> -->
  </div>
</template>
<script>
  export default {
    data() {
      return {
        showLoading: true // 控制全局加载状态
      }
    },

    created() {
      if (!process.client) return
      // 初始化数据
      this.initializeData()
      //监听文档加载状态
    },
    // mounted() {
    //   this.handleDocumentLoadState()
    // },
    methods: {
      // 初始化所有需要的数据
      async initializeData() {
        const initActions = [
          ['initData/getInitData', '初始化基础数据'],
          ['initData/getInitData2', '获取多语言数据'],
          ['initData/getCategoryData', '获取分类数据'],
          ['initData/getFooterData', '获取页脚数据']
        ]
        try {
          await Promise.all(initActions.map(([action]) => this.$store.dispatch(action)))
          this.$nuxt.$loading.finish()
        } catch (error) {
          console.error('数据初始化失败:', error)
        }
      }
    }
  }
</script>
<style lang="less">
  img {
    border: none !important;
  }
</style>
